﻿using System.Collections.Generic;
using ChampionsLeagueBets.Domain;
using ChampionsLeagueBets.Infrastructure;
using ChampionsLeagueBets.Web.Mvc.Authentication;
using ChampionsLeagueBets.Web.Mvc.Common;
using SharpArch.NHibernate.Contracts.Repositories;

namespace ChampionsLeagueBets.Web.Mvc.Controllers
{
    using System.Web.Mvc;

    public class HomeController : Controller
    {
		private readonly IExRepository<Tournament> _tournamentRepository;

		public HomeController(IExRepository<Tournament> tournamentRepository)
		{
			_tournamentRepository = tournamentRepository;
		}

    	public ActionResult Index()
    	{
    		IList<Tournament> tournaments = _tournamentRepository.GetAll();
			return View(tournaments);
        }

		public object Administration()
		{
			if (!RightPrincipal.CurrentUser.IsAdmin) return NoRights();

			return View();
		}

		public ActionResult NoRights()
		{
			return View();
		}
    }
}
